package io.finer.erp.jeecg.finance.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.finer.erp.jeecg.bas.vo.SalesDeliveryOrEntryVO;
import io.finer.erp.jeecg.finance.dto.FinaFurlEntryDTO;
import io.finer.erp.jeecg.finance.dto.FinaFurlSumDTO;
import io.finer.erp.jeecg.finance.dto.FinaPaymentDto;
import io.finer.erp.jeecg.finance.dto.ReceiveDTO;
import io.finer.erp.jeecg.finance.entity.FinaPayment;
import com.baomidou.mybatisplus.extension.service.IService;
import io.finer.erp.jeecg.finance.vo.*;
import io.finer.erp.jeecg.stock.entity.StkIoBill;
import io.finer.erp.jeecg.stock.entity.StkIoBillEntry;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.jeecg.common.api.vo.Result;

/**
 * @Description: 付款表
 * @Author: jeecg-boot
 * @Date:   2021-03-22
 * @Version: V1.0
 */
public interface IFinaPaymentService extends IService<FinaPayment> {


    /**
     * 应收/已收统计列表
     * @param page
     * @return
     */
	List<FinaPaymentPage> getPayment(FinaPaymentPage finaPayment);

    /**
     * 列表金额合计
     * @Author: libaow
     * @Description:
     * @DateTime: 16:20 2021/5/14
     */
    FinaPaymentPageSum getPageReceiptSum(
            String createTimeStart, String createTimeEnd,
            String supplierName,
            BigDecimal receivablesEnd,
            BigDecimal receivablesStart,
            BigDecimal receivedsEnd,BigDecimal receivedsStart,
            BigDecimal invoicePriceStart,BigDecimal invoicePriceEnd,
            BigDecimal discountSumPriceStart,BigDecimal discountSumPriceEnd);


    Page<FinaPaymentSumPage> getSumPayment(IPage<FinaPaymentSumPage> page,String createTimeStart, String createTimeEnd, String supplierName);

    boolean marchFlat(FinaPayment finaPayment);

    void createPayable(StkIoBill stkIoBill, List<StkIoBillEntry> stkIoBillEntryList);
	
    void createPayable(StkIoBill stkIoBill, StkIoBillEntry entry);

    List<FinaPaymentDto> getPaymentEx(String createTimeStart, String createTimeEnd, String supplierName);

    FinaReceiptSumVO getamountFK();

    List<CGDIoBillFKVo> getCGDIoBill(CGDIoBillFKVo cgdIoBillFKVo);

    boolean automaticWriteOff(FinaPaymentAddVo paymentAddVo);

    Map<String, Object> getFinaFurl  (String receiptType, String supplierId, String createTimeStart, String endTime,
							            String salesType, String code, String productName,
							            Integer viceQtyStart,Integer viceQtyEnd,BigDecimal qtyStart,
							            BigDecimal qtyEnd, BigDecimal unitPriceStart, BigDecimal unitPriceEnd,
							            BigDecimal totalPriceStart, BigDecimal totalPriceEnd, BigDecimal totalAmountStart,
							            BigDecimal totalAmountEnd, BigDecimal hxPriceStart, BigDecimal hxPriceEnd,
							            BigDecimal zkPriceStart, BigDecimal zkPriceEnd, BigDecimal qkPriceStart,
							            BigDecimal qkPriceEnd, String remark);

	/**
	 * @Description 列表查询
	 * @param page
	 * @param req
	 * @return
	 * Create at: 2021-06-16 17:00:38
	 * @author: duany
	 * Revision:
	 *    2021-06-16 17:00:38 - first revision by duany
	 *        
	 */
	IPage<FinaPayment> paymentList(Page<FinaPayment> page, HttpServletRequest req);

	/**
	 * @Description 根据供应商查询应付情况
	 * @param supplierId
	 * @return
	 * Create at: 2021-06-17 13:51:39
	 * @author: duany
	 * Revision:
	 *    2021-06-17 13:51:39 - first revision by duany
	 *        
	 */
	List<ReceiveDTO> getSupplierReceive(String supplierId);

	/**
	 * @Description 新增付款单操作
	 * @param paymentVO 封装的付款单信息
	 * @return
	 * Create at: 2021-06-17 15:16:30
	 * @author: duany
	 * Revision:
	 *    2021-06-17 15:16:30 - first revision by duany
	 *        
	 */
	Result<?> addPayment(PaymentVO paymentVO);
	
	/**
	 * @Description 修改付款单操作
	 * @param paymentVO 封装的付款单信息
	 * @return
	 * Create at: 2021-06-18 15:04:28
	 * @author: duany
	 * Revision:
	 *    2021-06-18 15:04:28 - first revision by duany
	 *        
	 */
	Result<?> updatePayment(PaymentVO paymentVO);

	/**
	 * @Description 获取详情信息
	 * @param paymentId
	 * @return
	 * Create at: 2021-06-18 17:09:27
	 * @author: duany
	 * Revision:
	 *    2021-06-18 17:09:27 - first revision by duany
	 *        
	 */
	Result<PaymentVO> getPaymentInfo(String paymentId);
	
	/**
     * @Description: 收货汇总
     * @param finaFurlVO
     * @return
     * Create at: 2021-06-17 14:24:22
     * @author: xzs
     * Revision:
     *    2021-06-17 14:24:22 - first revision by xzs
     *
     */
    List<FinaFurlSumDTO> getFurlSum(FinaFurlVO finaFurlVO);
    
    /**
     * @Description 收货明细汇总
     * @param finaFurlVO
     * @return
     * Create at: 2021-06-17 15:03:09
     * @author: xzs
     * Revision:
     *    2021-06-17 15:03:09 - first revision by xzs
     *
     */
    List<FinaFurlEntryDTO> getFurlEntrySum(FinaFurlVO finaFurlVO);

	/**
	 * @Description 付款单统计
	 * @param finaPayment
	 * @param req
	 * @return
	 * Create at: 2021-06-21 17:33:53
	 * @author: duany
	 * Revision:
	 *    2021-06-21 17:33:53 - first revision by duany
	 *        
	 */
	Result<?> getPaymentStatistic(FinaPayment finaPayment, HttpServletRequest req);

}
